<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta charset="utf-8"/>
    <title>系统-菜单列表</title>
    <meta name="description" content="overview &amp; stats"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
    <!-- bootstrap & fontawesome -->
    <link rel="stylesheet" href="${request.contextPath}/static/assets/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="${request.contextPath}/static/assets/font-awesome/4.7.0/css/font-awesome.min.css"/>
    <!-- text fonts -->
    <link rel="stylesheet" href="${request.contextPath}/static/assets/css/fonts.googleapis.com.css"/>
    <!-- ace styles -->
    <link rel="stylesheet" href="${request.contextPath}/static/assets/css/ace.min.css" class="ace-main-stylesheet"
          id="main-ace-style"/>
    <link rel="stylesheet" href="${request.contextPath}/static/assets/css/ace-skins.min.css"/>
    <link rel="stylesheet" href="${request.contextPath}/static/assets/css/ace-rtl.min.css"/>
    <!-- ace settings handler -->
    <script src="${request.contextPath}/static/assets/js/jquery-2.1.4.min.js"></script>
    <script src="${request.contextPath}/static/assets/js/ace-extra.min.js"></script>
    <script src="${request.contextPath}/static/assets/js/bootbox.min.js"></script>

    <script src="${request.contextPath}/static/assets/js/user/base.js"></script>
    <link rel="stylesheet" href="${request.contextPath}/static/assets/css/bsie-paginator.css"/>
    <link rel="stylesheet" href="${request.contextPath}/static/stylesheets/console.css" />
</head>

<body class="skin-2" style="background-color: #FFF;">
<div class="tabbable">
    <div class="tab-content">
        <div id="manage" class="tab-pane active in">
            <div class="row">
                <div class="col-xs-12">
                    <div class="clearfix">
                        <div class="pull-left tableTools-container">
                            <button class="btn btn-xs btn-primary" onclick="skip('${request.contextPath}/menu/newMenu')"><i
                                    class="ace-icon fa fa-pencil-square-o align-top bigger-125"></i>新增
                            </button>
                        </div>
                    </div>
                    <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">

                        <table id="dynamic-table"
                               class="table table-striped table-bordered table-hover dataTable no-footer" role="grid"
                               aria-describedby="dynamic-table_info">
                            <thead>
                            <tr>
                                <th>No.</th>
								<th>父级编号</th>
								<th>名称</th>
								<th>排序</th>
								<th>链接</th>
								<th>图标</th>
								<th>是否显示</th>
								<th>权限标识</th>
								<th>备注信息</th>
								<th>是否启用</th>
								<th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
	                            <#if page?? && page.results&gt;0>
									<#list page.rows as menu>
									<tr class="">
										<td>${menu_index + 1}</td>
										<td>${menu.parentName!}</td>
										<td>${menu.name!}</td>
										<td>${menu.sort!}</td>
										<td>${menu.href!}</td>
										<td>${menu.icon!}</td>
										<td><#if menu.isShow==1>
														是
													<#else>
														否
													</#if></td>
										<td>${menu.permission!}</td>
										<td>${menu.remarks!}</td>
										<td>
											<#if menu.delFlag==0>
												启用
											<#else>
												停用
											</#if>
										</td>
										<td>
											<a class="btn btn-minier btn-primary" href="${request.contextPath}/menu/edit?id=${menu.id!}"  role="button">编辑</a>
											<a class="btn btn-minier btn-danger deleteMenu" href="javascript:void(0)" menuId="${menu.id!}" role="button">删除</a>
										</td>
									</tr>
								</#list>
								<#else>
									<tr>
										<td colspan="12">
											<div class="alert alert-danger" style="margin-bottom: 0px;" role="alert">没有记录!</div>
										</td>
									</tr>
								</#if>
                            </tbody>
                        </table>
                        <#include "/common/gridpager.html">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="${request.contextPath}/static/assets/js/bootstrap.min.js"></script>

<!-- page specific plugin scripts -->
<script src="${request.contextPath}/static/assets/js/jquery-ui.min.js"></script>
<script src="${request.contextPath}/static/assets/js/jquery.ui.touch-punch.min.js"></script>
<script src="${request.contextPath}/static/assets/js/jquery.gritter.min.js"></script>

<!-- ace scripts -->
<script src="${request.contextPath}/static/assets/js/ace-elements.min.js"></script>
<script src="${request.contextPath}/static/assets/js/ace.min.js"></script>
<script type="text/javascript">
    if ('ontouchstart' in document.documentElement) document.write("<script src='${request.contextPath}/static/assets/js/jquery.mobile.custom.min.js'>" + "<" + "/script>");
    jQuery(function($) {
    	//刪除菜单
    	$('.deleteMenu').click(function(){
    		var id = $(this).attr('menuId');
    		bootbox.dialog({
				message: "确定删除吗？", 
				buttons: {
					"success" : {
						"label" : "确定",
						"className" : "btn-sm btn-primary",
						"callback" :function(){
							$.ajax({
								type : 'post',
								url : '${request.contextPath}/menu/delete',
								dataType : 'json',
								data : {
									id : id,
								},
								success : function(result){
									if(result.code==0){
										window.location.reload();
									}else{
										reminder(result.message);
									}
								}
							});
						}
					}
				}
			});
    	});
    })
</script>

</body>
</html>